<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>  
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page import="org.apache.shiro.SecurityUtils" %>
<%@ page import="com.topisv.tms.entity.Function" %>
<%@ page import="java.util.List" %>
<%@ page import="com.topisv.tms.service.account.ShiroDbRealm.ShiroUser" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<title>风之鱼 WMS<sitemesh:title/></title>
<script type="text/javascript">
 var path='${ctx}';
</script>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<%@ include file="/WEB-INF/layouts/v1/mete_v1.jsp"%>

<sitemesh:head/>


</head>

<body>
		<%@ include file="/WEB-INF/layouts/v1/header_v1.jsp"%>
	<div class="container-fluid" id='left-container'>
	<div class="row-fluid">
	<shiro:user>
	<div class="span2" id='tms_meni'>



	
<!-- 新菜单  开始-->		    
<div class="menu">
<ul class="nav nav-list bs-docs-sidenav">

<%
	ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
	List<Function> menus = user.menus;
	if(menus != null)
	{
		for(int i=0; i<menus.size(); i++)
		{
			Function menu = menus.get(i);
			String menuName = menu.getShowname();
			String menuUrl = menu.getUrlprefix();
			List<Function> childMenus = menu.getChildMenu();
          %>

           <shiro:hasPermission name="<%=menuUrl%>">

	     <li><a href="#" ><%=menuName %></a><!-- 1 level begin-->
         
         <%	if(childMenus.size() != 0){%>
		 
		  <ul <%if(menuName.equals("订单处理")||menuName.equals("集发宝作业管理")){%> style="display: block;" <%}%> class="nav nav-tab ">
				<%
					for(int j=0; j<childMenus.size(); j++)
					{
						Function childMenu = childMenus.get(j);
						String childMenuName = childMenu.getShowname();
						String childMenuUrl = childMenu.getViewurl();
						List<Function> childMenus2 = childMenu.getChildMenu();
				%>
		 <shiro:hasPermission name="<%=childMenuUrl %>">
		    <li><a href="${ctx}<%=childMenuUrl %>" ><%=childMenuName %></a>  <!-- 2 level begin -->
		                                    
		                                    <%
											if(childMenus2 != null)
											{
											%>
											<%
											for(Function child : childMenus2)
											{
							                %>
							                <ul class="nav-stacked">
							                <shiro:hasPermission name="<%=child.getViewurl() %>">
					                          <li><a href="${ctx}<%=child.getViewurl() %>"><%=child.getShowname() %></a></li>
				                            </shiro:hasPermission>
				                            </ul>
								            <%} // for 3 %>
									         
								            
		                                    
		                                     <%} // if 3 %>
		    
		  </li><!-- 2 level end -->
		  </shiro:hasPermission>
		  <% 
           } // for 2
          %>
		
		  </ul>
		
		  <% 
           } // if 2
          %>

</li><!-- 1 level end -->
</shiro:hasPermission>
<% 
    } // for 1
} // if 1
%>	

</ul>
</div>
		    
<!-- 新菜单  结束-->			    
		    



	</div>
	</shiro:user>
<div class="span10" id="right-container">
		    	<sitemesh:body/>
		    <!--Body content-->
</div>
</div>
</div>
    <%@ include file="/WEB-INF/layouts/v1/footer_v1.jsp"%>
	<script src="${ctx}/static/bootstrap/2.1.1/js/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>